package com.seeyon.apps.restext;

import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import com.seeyon.client.CTPRestClient;

public class RestOrganizationDemorestsample111  {

//批量创建部门(Since:V61):注意：单位下必须没有启用的部门，才能够进行批量创建】
 public static void testAddDepartments() {
    List reslist=new ArrayList();
    Map newDep = new HashMap() {
        {
            put("orgAccountId", "9125108164295737923"); //单位ID
            put("code", "00000");//编号
            put("name", "我是一个空公司");//姓名
            put("description", "");//
            put("enabled", "true");//启用是否
            put("superior", "-6801507105928098264");//父级ID
         }
    };
    reslist.add(newDep);
    CTPRestClient client = ClientResource.getInstance().resouresClent();
    String result = client.post("/orgDepartment/addDepartments",reslist, String.class);
    System.out.println(result);
    System.out.println("1");
}

//批量修改部门(Since:V61)
public static void testUpdateDepartments() {
   List reslist=new ArrayList();
   Map res = new HashMap();
   res.put("id","4812819786082896217");//需要修改部门ID
   res.put("description", "11111");//修改项
   reslist.add(res);
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.post("/orgDepartment/updateDepartments",reslist, String.class);
   System.out.println(result);
}

//批量创建岗位(Since:V61)
public static void testAddPosts() {
   List reslist=new ArrayList();
   Map newDep = new HashMap() {
       {
           put("orgAccountId", "-3269485352497821575"); //单位ID
           put("name", "办公室1112"); //岗位名
           put("code", "111"); //岗位编码
           put("description", "by"); //岗位描述
           put("levelId", "2"); //岗位类别ID
       }
   };
   reslist.add(newDep);
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.post("orgPost/addPosts" ,reslist, String.class);
   System.out.println(result);
   
}

//按岗位Id批量修改岗位信息(Since:V61)
public static void testUpdatePosts() {
   List reslist=new ArrayList();
   Map res = new HashMap();
   res.put("id","3115467402330456348");//岗位ID
   res.put("description", "11"); //修改项
   reslist.add(res);
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.post("/orgPost/updatePosts" ,reslist, String.class);
   System.out.println(result);
}

//批量新建人员(Since:V61)
public static void addMembers() {
   List reslist=new ArrayList();
   Map newMember = new HashMap() {
        {
            put("orgAccountId", "-3269485352497821575"); //单位ID
            put("code","");//编号
            put("name","mary");//姓名
            put("orgDepartmentId", "7491018457365105489");//部门ID
            put("telNumber", "12345678");//移动电话
            put("officeNum", "0456123456");//办公电话
            put("emailAddress", "1232@163.com");//电子邮件
            put("gender", "女");//性别
            put("password", "admin123");//密码
            put("loginName","mary");//登录名
            put("birthday", "19990303");//出生日期"birthday":567964800000
            put("orgLevelId", "8804339723118595609");//职务ID
            put("orgPostId", "3115467402330456348");//岗位ID
         }
     };
    reslist.add(newMember);
    CTPRestClient client = ClientResource.getInstance().resouresClent();
    String result = client.post("orgMember/addMembers",reslist,String.class);
    System.out.println(result);
    
   
}

//按Id批量修改人员信息(Since:V61)
public static void updateMembers() {
   List reslist=new ArrayList();
   Map newMember = new HashMap() {
       {
           put("id","-1730833917365171641");
           put("description", "lalalal");
           put("orgAccountId","-408122534799651043");
       }
   };
   reslist.add(newMember);
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.post("orgMember/updateMembers",reslist,String.class);
   System.out.println(result);
   System.out.println("q");
}
public static void main(String args[]){
//   testAddDepartments();
//   testUpdateDepartments();
//   testAddPosts();
//   testUpdatePosts();
//   addMembers();
//     updateMembers();
}
}